package com.vshop.service.impl;

import com.vshop.entity.comentity.PartnerPackage;
import com.vshop.mapper.PartnerPackageMapper;
import com.vshop.service.PartnerPackageService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lm
 * @date 2020/8/27 13:41
 */
@Service
@Transactional(rollbackFor = Exception.class)

public class PartnerPackageServiceImpl implements PartnerPackageService {
    @Resource
    PartnerPackageMapper partnerPackageMapper;

    @Override

    public String queryPackageNameAs(String partnerCode,
                                     String packageCode) {
        return partnerPackageMapper.queryPackageNameAs(partnerCode, packageCode);
    }


    @Override

    public List<PartnerPackage> queryPackageByCode(String packageCode,
                                                   String partnerCode,
                                                   String partnerScope) {
        return partnerPackageMapper.queryPackageByCode(packageCode, partnerCode, partnerScope);
    }

    @Override

    public List<PartnerPackage> queryPackageListByCode(String partnerCode,
                                                       String packageCode,
                                                       String salesType) {
        return partnerPackageMapper.queryPackageListByCode(partnerCode, packageCode, salesType);
    }

    @Override

    public String queryPackageNameEN(String packageCode,
                                     String partnerCode) {
        return partnerPackageMapper.queryPackageNameEN(packageCode, partnerCode);
    }

    @Override

    public String queryBuyType(String packageCode,
                               String partnerCode) {
        return partnerPackageMapper.queryBuyType(packageCode, partnerCode);
    }

    @Override

    public String queryPackageNameByCode(String packageCode,
                                         String partnerCode) {
        return partnerPackageMapper.queryPackageNameByCode(packageCode, partnerCode);
    }

    @Override

    public String queryPriceType(String packageCode,
                                 String partnerCode) {
        return partnerPackageMapper.queryPriceType(packageCode, partnerCode);
    }

    @Override

    public List<PartnerPackage> queryMoreSpecailPackage(String partnerCode,
                                                        String partnerScope,
                                                        String salesType) {
        return partnerPackageMapper.queryMoreSpecailPackage(partnerCode, partnerScope, salesType);
    }

    @Override

    public List<PartnerPackage> queryListByCode(String partnerCode,
                                                String packageCode) {
        return partnerPackageMapper.queryListByCode(partnerCode, packageCode);
    }

    @Override
    public List<PartnerPackage> queryPackageByCondition(String partnerCode,
                                                        String deviceCode,
                                                        String country,
                                                        String continent,
                                                        String packageType,
                                                        String salesType) {
        return partnerPackageMapper.queryPackageByCondition(partnerCode, deviceCode, country, continent, packageType, salesType);
    }

    @Override
    public List<PartnerPackage> queryPackageByConditionEN(String partnerCode,
                                                          String deviceCode,
                                                          String country,
                                                          String continent,
                                                          String packageType,
                                                          String salesType) {
        return partnerPackageMapper.queryPackageByConditionEN(partnerCode, deviceCode, country, continent, packageType, salesType);
    }

    @Override

    public String querySalesType(String packageCode,
                                 String partnerCode) {
        return partnerPackageMapper.querySalesType(packageCode, partnerCode);
    }

    @Override
    //@DataSource(name = "second")

    public int findCountByCondition(String packageCode,
                                    String partnerCode) {
        return partnerPackageMapper.findCountByCondition(packageCode, partnerCode);
    }

    @Override
    //@CacheEvict(cacheNames = "packages", allEntries = true)
    //@DataSource(name = "second")

    public void storagePackage(PartnerPackage product) {
        partnerPackageMapper.storagePackage(product);
    }

    @Override
    //@DataSource(name = "second")

    public void update_package_usage_attribute(PartnerPackage pro) {
        partnerPackageMapper.update_package_usage_attribute(pro);
    }

    @Override
    //@DataSource(name = "second")

    public String queryPackageStatusByCode(String packageCode,
                                           String partnerCode) {
        return partnerPackageMapper.queryPackageStatusByCode(packageCode, partnerCode);
    }

    @Override
    // 清除缓存操作
    //@CacheEvict(cacheNames = "packages", allEntries = true)
    //@DataSource(name = "second")

    public void updatePackageStatus(PartnerPackage product) {
        partnerPackageMapper.updatePackageStatus(product);
    }

    @Override
    public List<PartnerPackage> queryTejiaPackageByCode(String partnerCode,
                                                        String deviceCode) {
        return partnerPackageMapper.queryTejiaPackageByCode(partnerCode, deviceCode);
    }


    @Override

    public String queryPackageTypeByCode(String packageCode,
                                         String partnerCode) {
        return partnerPackageMapper.queryPackageTypeByCode(packageCode, partnerCode);
    }

    /**
     * 未分表之前的简版首页查询套餐列表的方法
     * <p>
     * key = "#root.method.name" 可获得querySimplePackageListByPartnerCode这个名字
     *
     * @param partnerCode
     * @param deviceCode
     * @return
     */
    @Override

    //@Cacheable(value = "packages", key = "#p0+'_'+#p1")

    public List<PartnerPackage> querySimplePackageListByPartnerCode(String partnerCode,
                                                                    String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode(partnerCode, deviceCode);
    }

    @Override

    //@Cacheable(value = "packages", key = "#p0")

    public List<PartnerPackage> getServicePlanList(String partnerCode) {
        return partnerPackageMapper.getServicePlanList(partnerCode);
    }

    @Override

    //@Cacheable(value = "packages", key = "'packages_'+#p0+'_'+#p1")

    public List<PartnerPackage> getPackageListByCode(String partnerCode,
                                                     String packageCode) {
        return partnerPackageMapper.getPackageListByCode(partnerCode, packageCode);
    }


    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_0(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_0(partnerCode, deviceCode);
    }

    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_1(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_1(partnerCode, deviceCode);
    }

    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_2(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_2(partnerCode, deviceCode);
    }

    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_3(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_3(partnerCode, deviceCode);
    }

    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_4(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_4(partnerCode, deviceCode);
    }

    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_5(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_5(partnerCode, deviceCode);
    }

    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_6(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_6(partnerCode, deviceCode);
    }

    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_7(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_7(partnerCode, deviceCode);
    }

    @Override
    public List<PartnerPackage> querySimplePackageListByPartnerCode_8(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_8(partnerCode, deviceCode);
    }

    @Override

    public List<PartnerPackage> querySimplePackageListByPartnerCode_9(String partnerCode,
                                                                      String deviceCode) {
        return partnerPackageMapper.querySimplePackageListByPartnerCode_9(partnerCode, deviceCode);
    }

}
